<?php
namespace app\system\controller;
use app\system\controller\SystemController;
/**
 * 系统首页
 */
class IndexController extends SystemController {

    /**
     * 当前模块参数
     */
	protected function _infoModule(){
		return array(
            'info' => array(
                    'name' => '管理首页',
                    'description' => '系统运行信息',
                ),
            'menu' => array(
                    array(
                        'name' => '系统信息',
                        'icon' => 'home',
                    ),
                )
            );
	}
	/**
     * 首页
     */
    public function index(){
        $bgColor = array('blue', 'red', 'green', 'orange', 'grey');
        $quickMenu = unserialize($this->loginUserInfo['quick']);
        if(!empty($quickMenu)){
            foreach ($quickMenu as $key => $value) {
                $quickMenu[$key]['color'] = $bgColor[rand(0,4)];
            }
        }
        $startTime = strtotime(config('COPYRIGHT.COPYRIGHT_TIME'));
        $stopTime = time();
        $runTime = $stopTime - $startTime;
        $runTime = ceil($runTime / 86400);
        $this->assign('quickMenu', $quickMenu);
        $this->assign('runTime', $runTime);
        $this->assign('userCount', target('system/SystemUser')->countList());
        $this->assign('appCount', count(target('system/Functions')->loadList()));
        $this->assign('logCount', target('system/SystemLog')->countList());
        $this->systemDisplay();
    }
}

